{template 'public/header'}
{template 'public/comhead'}
<input type="hidden" name="schoolid" value="{$schoolid}" />
    <div class="panel panel-info">
        <div class="panel-body">
           {php echo $this -> set_tabbar($action1, $schoolid, $_W['role'], $_W['isfounder']);}
        </div>
    </div>
<ul class="nav nav-tabs">
    <li {if $operation == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('theclass', array('op' => 'post', 'schoolid' => $schoolid))}">添加班级</a></li>
    <li {if $operation == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('theclass', array('op' => 'display', 'schoolid' => $schoolid))}">班级管理</a></li>
</ul>
 <style>
.cLine {overflow: hidden;padding: 5px 0;color:#000000;}
.alert {padding: 8px 35px 0 10px;text-shadow: none;-webkit-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);-moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
background-color: #f9edbe;border: 1px solid #f0c36d;-webkit-border-radius: 2px;-moz-border-radius: 2px;border-radius: 2px;color: #333333;margin-top: 5px;}
.alert p {margin: 0 0 10px;display: block;}
.alert .bold{font-weight:bold;}
 </style>
<div class="cLine">
    <div class="alert">
    <p><span class="bold">使用方法：</span>    填写班级,如 高一一班,高一二班,高一三班.... </br>   
   <strong><font color='red'>特别提醒: 当你删除该班级项的时候,该班级项下相关的所有数据都会被删除,请谨慎操作!以免丢失数据!</font></strong></br>
   <strong><font style="color:#641DBF;">教室监控: 请查看商业群教室流媒体设置方法!</font></strong>
    </p>
    </div>
</div>
{if $operation == 'post'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <!-- <input type="hidden" name="parentid" value="{$parent['id']}" /> -->
        <input type="hidden" name="schoolid" value="{$schoolid}" />		
        <div class="panel panel-default">
            <div class="panel-heading">
                班级分类编辑
            </div>
            <div class="panel-body">
                
                <div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">所属年级</label>
					<div class="col-sm-2 col-lg-2">
                        <select style="margin-right:15px;" name="parentid" class="form-control">
                            <option value="0">请选择年级</option>
                            {loop $xueqi $it}
                                <option value="{$it['sid']}" {if $it['sid'] == $theclass['parentid']} selected="selected"{/if}>{$it['sname']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
					<div class="input-group">
                        <input type="text" name="ssort" class="form-control" value="{$theclass['ssort']}" />
                    </div>
					</div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">班级名称</label>
                    <div class="col-sm-9">
					<div class="input-group">
                        <input type="text" name="catename" class="form-control" value="{$theclass['sname']}" />
                    </div>
					</div>
                </div>
				<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">班级主任</label>
                    <div class="col-sm-2 col-lg-2">
                        <select style="margin-right:15px;" name="tid" class="form-control">
                            <option value="0">请选择班级主任或管理</option>
                            {loop $allls $it}
                                <option value="{$it['id']}" {if $it['id'] == $theclass['tid']} selected="selected"{/if}>{$it['tname']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">报名费:</label>
                    <div class="col-sm-9">
						<div class="input-group">
							<input type="text" name="cost" class="form-control" value="{$theclass['cost']}" />前端报名本班需要支付的费用
						</div>
                    </div>
                </div>				
                <!-- 暂时停用 -->				
                <!--div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">微群二维码</label>
                    <div class="col-sm-9">
                        {php echo tpl_form_field_image('erwei', $theclass['erwei'])}
                    </div>
                </div-->
				
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">教室监控</label>
                    <div class="col-sm-9">
                        <input type="text" name="video" class="form-control" value="{$theclass['video']}" />配置方法见商业群文件
                    </div>
                </div>
<!-- 				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">教室监控rmtp</label>
                    <div class="col-sm-9">
                        <input type="text" name="video1" class="form-control" value="{$theclass['video1']}" />HLS，RMTP二选一
                    </div>
                </div>	 -->			
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">监控可用时间段</label>
					<div class="col-sm-9 col-xs-9 col-md-4">
							<div class="input-group clockpicker" style="margin-bottom: 15px">
								{php echo tpl_form_field_clock('videostart', $theclass['videostart'])}
								<span class="input-group-addon">至</span>
								{php echo tpl_form_field_clock('videoend', $theclass['videoend'])}
								<span class="input-group-addon"></span>
							</div>
					</div>
				</div>	
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">监控允许评论</label>
                    <div class="col-sm-9">
                        <label for="isshow1" class="radio-inline"><input type="radio" name="allowpy" value="1" id="isshow1" {if empty($theclass) || $theclass['allowpy'] == 1}checked="true"{/if} /> 允许</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="isshow2" class="radio-inline"><input type="radio" name="allowpy" value="2" id="isshow2"  {if !empty($theclass) && $theclass['allowpy'] == 2}checked="true"{/if} /> 拒绝</label>
                        <span class="help-block"></span>
                    </div>
                </div>				
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">QQ群链接</label>
                    <div class="col-sm-9">
                        <input type="text" name="qun" class="form-control" value="{$theclass['qun']}" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{elseif $operation == 'display'}
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
            <a class="btn btn-primary" href="javascript:location.reload()"><i class="fa fa-refresh"></i>刷新</a>
        </div>
    </div>
    <div class="panel panel-default">
        <form action="" method="post" class="form-horizontal form" >
            <input type="hidden" name="schoolid" value="{$schoolid}" />
            <div class="table-responsive panel-body">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>
					    <th style="width:100px;">序号</th>
						<th>所属年级</th>
                        <th>班级名称</th>
						<th>班级主任</th>
						<th>学生人数</th>
						<th>班级QQ群</th>
						<th>教室监控</th>
						<th>监控可用时间</th>
						<th>报名费</th>
                        <th style="text-align:right;">编辑/删除</th>
                    </tr>
                    </thead>
                    <tbody id="level-list">
                    {loop $theclass $row}
                    <tr>
					    <td><div class="type-parent">{$row['sid']}</div></td>
						<td><div class="type-parent">{$row['xueqi']}</div></td>
                        <td><div class="type-parent">{$row['sname']}&nbsp;&nbsp;</div></td>
						<td><div class="type-parent">{$row['name']}</div></td>
						<td><span class="label label-danger">{$row['renshu']}人</span></td>
						<td><div class="type-parent">{$row['qun']}&nbsp;&nbsp;</div></td>
						<td>{if !empty($row['video']) || !empty($row['video1'])}<span class="label label-info">已启用</span>{else}<span class="label label-danger">未启用</span>{/if}</td>
						<td>{if !empty($row['videostart'])}<span class="label label-success">{$row['videostart']}&nbsp;至&nbsp;{$row['videoend']}</span>{/if}</td>
						<td>{if !empty($row['cost'])}<span class="label label-success">￥{$row['cost']}</span>{else}<span class="label label-danger">未启用</span>{/if}</td>
                        <td style="text-align:right;"><a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('theclass', array('op' => 'post', 'sid' => $row['sid'], 'schoolid' => $schoolid))}" title="编辑"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('theclass', array('op' => 'delete', 'sid' => $row['sid'], 'schoolid' => $schoolid))}" onclick="return confirm('确认删除此分类吗？');return false;" title="删除"><i class="fa fa-times"></i></a></td>
                    </tr>
                    {/loop}
                    <!--tr>
                        <td colspan="3">
                            <input name="submit" type="submit" class="btn btn-primary" value="批量更新排序">
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </td>
                    </tr-->
                    </tbody>
                </table>
            </div>
        </form>
    </div>
    {$pager}
</div>
{/if}
{template 'public/footer'}